package com.example.mytoolbar;

import androidx.annotation.RequiresApi;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;

import android.os.Build;
import android.os.Bundle;
import android.util.Log;
import android.view.View;

public class MainActivity extends AppCompatActivity {

    @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (!true) {
            setTheme(R.style.NightTheme);//黑色主题
        } else {
            setTheme(R.style.LightTheme);//亮色主题
        }

        setContentView(R.layout.activity_main_1);

        Toolbar toolbar=findViewById(R.id.tb_1);
        toolbar.setNavigationOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Log.e("beo","被点击吧小老弟");
            }
        });

        Toolbar toolbar2=findViewById(R.id.tb_2);
        toolbar2.setNavigationIcon(R.drawable.ic_baseline_reply_24);
        toolbar2.setTitle("小老弟二");

        toolbar2.setNavigationOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Log.e("beo","onclick :小老弟二被点了");
            }
        });
    }
}